package com.xyz.business.dao.impl;

import java.sql.SQLException;
import java.util.List;

import com.xyz.base.dao.BaseDao;
import com.xyz.business.bean.Config;
import com.xyz.business.dao.ConfigDao;

public class ConfigDaoImpl extends BaseDao implements ConfigDao {

	@SuppressWarnings("unchecked")
	@Override
	public List<Config> queryAll() throws SQLException {
		return sqlMapClient.queryForList("queryAllConifig");
	}

	@Override
	public int updateConfig(Config config) throws SQLException {
		// Integer sum = isIpExit(config.getConfigid());
		// if (sum == null) {
		//
		// }
		return sqlMapClient.update("updateConfig", config);
	}

	private Integer isIpExit(String configid) {
		try {
			return (Integer) sqlMapClient.queryForObject("qrConfig", configid);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return 0;
	}

}
